if (mobileDevice === undefined) { var mobileDevice = false; } var urlHolder; var GameEventId = ''; var GameSound = true; var GameName = ''; var GameVersion = null; // new Game name should be added here (it is neccessary) var helpList = ['Balloon', 'Cappadocia', 'SpaceLotto', 'GemStones', 'LuckyDouble', 'Sicbo', 'LuckySeven', 'WheelOfLight', 'ZodiacScratch', 'CasinoHoldem', 'russinapoker', 'VaBank', 'SweetCandy', 'ThreeCardPoker', 'PlinkoX', 'FootballX', 'HunterX', 'MineIsland', 'SmashX', 'RollX']; let currencyCode = $('#CurrencyCode').val(); let fractionDigit = $('#FractionDigit').val(); if(currencyCode === undefined || currencyCode === '') currencyCode = 'GEL'; if(fractionDigit === undefined || fractionDigit === '') fractionDigit = 2; fractionDigit = parseInt(fractionDigit); function currencyFormat(currency, html = true) { return html ? '' + currency + '' : currency; } document.oncontextmenu = document.body.oncontextmenu = function () { return false; } if (mobileDevice) { window.addEventListener("load", function () { window.scrollTo(0, 0); }); document.addEventListener("touchmove", function (e) { e.preventDefault(); }); } function InitializeUrls(baseUrl, connrollerName, externalUrl) { urlHolder = { JackpotInfo: { Url: baseUrl + "/api/" + connrollerName + "/JackpotInfo" }, StartRequest: { Url: baseUrl + "/api/" + connrollerName + "/Start" }, Events: { Url: baseUrl + "/api/" + connrollerName + "/Events", PostEventUrl: baseUrl + "/api/" + connrollerName + "/Event", PostCustomEventUrl: baseUrl + "/api/" + connrollerName + "/CustomEvent" }, ReturnUrl: { Url: externalUrl }, Ping: { Url: baseUrl + "/api/" + connrollerName + "/Ping/2" }, GameExit: { Url: externalUrl }, Board: { Url: baseUrl + "/api/" + connrollerName + "/Board" } }; InitializeAdditionalUrls(baseUrl, connrollerName, externalUrl); } var locale = {}; function GetCaption(captionKey) { if (captionKey !== undefined && captionKey !== null && captionKey.constructor === Array) { var captionArray = new Array(); for (var i = 0; i < captionKey.length; i++) captionArray[i] = GetCaption(captionKey[i]); return captionArray; } else { caption = locale[captionKey]; return caption !== undefined ? caption : captionKey; } } var sounds; var audioElement = []; var audioVolumeList = []; for (var i = 0; i < 100; i++) { audioElement.push(null); audioVolumeList.push(0); } function soundLoaded(event) { for (var soundIndex in sounds) { if (sounds[soundIndex].id == event.id) { sounds[soundIndex].loaded = true; break; } } } var StaticContentUrl = ""; $(document).ready(function () { StaticContentUrl = ($('#StaticContentUrl').length ? $('#StaticContentUrl').val() : ""); if (StaticContentUrl.indexOf("?")) { StaticContentUrl = StaticContentUrl.split("?"); StaticContentUrl = StaticContentUrl[0]; } InitSound(); }); function InitSound() { if (!createjs.Sound.initializeDefaultPlugins()) { return; } // fills sounds array var assetsPath = InitGameSounds(); if(PIXI.sound) { for (let name in sounds) { sounds[name].sound = PIXI.sound.Sound.from({ url: assetsPath + sounds[name].src, preload: sounds[name].preload }); } } createjs.Sound.alternateExtensions = ["mp3"]; createjs.Sound.addEventListener("fileload", createjs.proxy(soundLoaded, this)); createjs.Sound.registerSounds(sounds, assetsPath); } let mutedGameplaySounds = false; function PlaySound(index, type, repeat, volume, pixiSound) { volume = (volume === undefined || volume === null) ? 1 : volume; audioVolumeList[index] = volume; if (GameName == 'Bingo') { if (type == 'Ball') { volume = 0.8; } else if (type == 'Sound') { volume = 0.1; } } else if (GameName == 'LuckyDouble') { if (type == 'Scratch') { volume = 0.75; } } else if (GameName == 'LuckySeven') { if (type == 'Scratch') { volume = 0.3; } } else if (GameName == 'GemStones') { if (type == 'GameMusic') { volume = 0.75; } } else if (GameName == 'TripleSeven') { var s = ['BetDouble', 'BetMax', 'BetMinus', 'BetPlus', 'Start', 'line1', 'line2', 'line3']; volume = 0.8; if (s.indexOf(type) >= 0) { volume = 1; } if (type == 'Sound') { volume = 0.4; } } for (var soundIndex in sounds) { if (sounds[soundIndex].id == type && !sounds[soundIndex].loaded) { var parentIndex = index; var parentType = type; var parentRepeat = repeat; var parentVolume = volume; setTimeout(function () { PlaySound(parentIndex, parentType, parentRepeat, parentVolume); }, 500); break; } } if ($('.game-sound-bt').hasClass('active') || $('.sound-bt').hasClass('active') || mutedGameplaySounds) { volume = 0; } if(pixiSound) { let item = null; if(index >= 0) { item = sounds[index]; } if(sounds[index] === undefined) { return false; } item = sounds[index].sound; audioElement[index] = item; audioElement[index].play({ loop: repeat, }); audioElement[index].volume = volume; return; } if (repeat == 1) { audioElement[index] = createjs.Sound.play(type, { interrupt: createjs.Sound.INTERRUPT_NONE, loop: -1, volume: volume }); } else { audioElement[index] = createjs.Sound.play(type, { interrupt: createjs.Sound.INTERRUPT_NONE, volume: volume }); } if (audioElement[index] == null || audioElement[index].playState == createjs.Sound.PLAY_FAILED) { return; } audioElement[index].addEventListener("complete", function (instance) { }); if (GameName == 'Cappadocia' || GameName == 'PlinkoX' || GameName == 'FootballX' || GameName == 'HunterX' || GameName == 'MineIsland') { // 1 index is a background music index if(!$('.game-music-bt').hasClass('active')) audioElement[1].muted = true; } } function StopSound(soundIndex) { if(sounds[soundIndex] !== null) { try { sounds[soundIndex].stop(); sounds[soundIndex] = null; } catch (e) { console.log(soundIndex, name); console.log(e); } } } var gamesLobby = false; if(window.self !== window.top) { var parentUrl = document.referrer; if(parentUrl.indexOf('OtherGamesLobby.aspx') >= 0) { gamesLobby = true; } } $(document).ready(function (e) { $(document).on('click', '.game-icon-bt', function () { $('.menu-div-sub').slideToggle(200); $('.game-icon-bt').toggleClass('active'); $('.menu-div').toggleClass('active'); }); $(document).on('click', '.menu-close', function () { $('.menu').fadeOut(200); }); if (mobileDevice) { window.addEventListener("load", function () { setTimeout(function () { window.scrollTo(0, 1); }, 0); }); let gameList = ['hunterx', 'mineisland', 'smashx', 'rollx', 'balloon'] $('*').click(function () { if ((window.fullScreen) || (window.innerWidth == screen.width && window.innerHeight == screen.height)) { } else { if ( !gameList.includes(GameName.toLowerCase()) && !bowser.ios){ launchFullscreen(document.documentElement); } } }); } $(document).on('click', '.game-exit-bt', function () { if( typeof gameEvent === 'function') gameEvent.quit(); if(GameName.toLowerCase() == "footballx" || GameName.toLowerCase() == "hunterx" || GameName.toLowerCase() == "smashx" || GameName.toLowerCase() == "rollx"){ leaveGame(); return }; try { if (document.fullscreenElement !== null) { // if (document.exitFullscreen) { // document.exitFullscreen(); // } else if (document.mozCancelFullScreen) { // document.mozCancelFullScreen(); // } else if (document.webkitExitFullscreen) { // document.webkitExitFullscreen(); // } exitFullscreen() } } catch (e) { } if (GameEventId != '') { PostCustomEvent('leave.game'); if (GameName === "Balloon") { gameEvent.quit(); } } else { if(gamesLobby) { parent.location.href = urlHolder.GameExit.Url; } else { top.location.href = urlHolder.GameExit.Url; } if (GameName === "Balloon") { gameEvent.quit(); } } }); $(document).on('click', '.sound-control', function () { if (GameName !== 'AnimationRoulette' && GameName !== 'BonusRoulette' && GameName !== 'HiLoSilver' && GameName !== 'Sicbo' && GameName !== 'HoneyWorld' && GameName !== 'DragRace' && GameName !== 'GemStones' && GameName !== 'ZodiacScratch' && GameName !== 'LuckySeven' && GameName !== 'LuckyDouble' && GameName !== 'Bingo') { if ($(this).hasClass('active')) { $(this).removeClass('active'); if (audioElement[1] !== null) audioElement[1].paused = false; } else { $(this).addClass('active'); if (audioElement[1] !== null) audioElement[1].paused = true; } } }); /* $(document).on('click', '.minigames-head-help', function () { $('.help-popup').fadeIn(200); }); $(document).on('click', '.help-bt', function () { $('.help-popup').fadeIn(200); }); */ $(document).on('click', '.help-div-close', function () { $('#help-popup').fadeOut(200); }); $(document).on('click', '.game-sound-bt', function () { GameSound = !GameSound; UpdateGameSound(GameSound); if (GameSound) { $('.game-sound-bt').removeClass('active'); //if(audioElement[0] !== null) { //audioElement[0].paused = false; //} for (var i = 0; i < audioElement.length; i++) { if (audioElement[i] !== null) { let volume = (audioVolumeList[i] === 0 ? 1 : audioVolumeList[i]) if(!$('.game-music-bt').hasClass('active')) volume = 0; audioElement[i].volume = volume; } // if(sounds[i] && sounds[i].sound) { // sounds[i].sound.volume = (audioVolumeList[i] === 0 ? 1 : audioVolumeList[i]); // } } } else { $('.game-sound-bt').addClass('active'); //if(audioElement[0] !== null) { //audioElement[0].paused = true; //} for (var i = 0; i < audioElement.length; i++) { if (audioElement[i] !== null) { //audioVolumeList[i] = audioElement[i].volume; audioElement[i].volume = 0; } // if(sounds[i] && sounds[i].sound) { // //audioVolumeList[i] = sounds[i].sound.volume; // sounds[i].sound.volume = 0; // } } } window.parent.postMessage({ name: "sound-status", status: !GameSound }, "*"); window.parent.postMessage({ payload: { settingName: "gameEventSound", settingValue: GameSound } }, "*"); }); $(document).on('click', '.game-music-bt', function() { if(GameName === "Cappadocia") { $(this).toggleClass('active'); // 1 index is a background music index audioElement[1].muted = !$(this).hasClass('active'); }else if(GameName === "PlinkoX"){ $(this).toggleClass('active'); audioElement[1].muted = !$(this).hasClass('active'); }else if(GameName === "FootballX"){ $(this).toggleClass('active'); audioElement[1].muted = !$(this).hasClass('active'); }else if(GameName === "HunterX"){ $(this).toggleClass('active'); audioElement[1].muted = !$(this).hasClass('active'); }else if (GameName === "MineIsland") { $(this).toggleClass('active'); audioElement[1].muted = !$(this).hasClass('active'); }else if (GameName === "RollX") { $(this).toggleClass('active'); audioElement[22].muted = !$(this).hasClass('active'); }else if (GameName === "SmashX") { $(this).toggleClass('active'); let isActiveBgSound = $('.game-music-bt').hasClass('active'); let isActiveMainSound = !$('.game-sound-bt').hasClass('active'); audioElement[1].volume = isActiveBgSound && isActiveMainSound ? (audioVolumeList[1] === 0 ? 1 : audioVolumeList[1]) : 0; } }) let ios = bowser.ios; let clickEvent = ios ? 'touchstart' : 'click'; $(document).on('click', '.close-help', function() { window.parent.postMessage({name: "show-loader-hood"}, "*"); window.parent.postMessage({name: "prize-drop-show-icon"}, "*"); }); $(document).on(clickEvent, '.game-help-bt, .menu-help', function () { $('.game-icon-bt').trigger('click'); if (helpList.indexOf(GameName) >= 0 && $('#help').contents().length > 1) { showHelp(); return false; } /*$('.lobby-popup').fadeIn(200); $('.lobby-popup-bg').fadeIn(200);*/ }); $(document).on('click', '.lobby-popup-close', function () { $('.lobby-popup').fadeOut(200); $('.lobby-popup-bg').fadeOut(200); }); $(document).on('click', '.game-fullscreen-bt', function () { if ($(this).hasClass('active')) { exitFullscreen() } else { launchFullscreen(document.documentElement); } }); $(document).on('click', '.game-history-bt', function () { }); ScaleDiv(); }); function backgroundMusicControll() { } $(document).ready(function (e) { ScaleDiv(); $(document).on('click', '.exit-bt', function () { PostCustomEvent('leave.game'); }); //disable quit when no returnurl function getParameterByName(name) { name = name.toLowerCase().replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)") var results = null; try { results = regex.exec(location.search.toLowerCase()); } catch (e) { } return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } function getParentParameterByName(name) { name = name.toLowerCase().replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); var results = null; try { results = regex.exec(parent.location.search.toLowerCase()); } catch (e) { } return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } function getReturnurl() { if (getParameterByName('ReturnUrl') !== '') { return getParameterByName('ReturnUrl'); } else if (getParentParameterByName('ReturnUrl') !== '') { return getParentParameterByName('ReturnUrl'); } else if (getParentParameterByName('returnUrl') !== '') { return getParentParameterByName('returnUrl'); }else if (getParentParameterByName('returnUrl') !== '') { return getParentParameterByName('returnUrl'); }else { return false } } if (!getReturnurl()) { $('.menu-popup-exit-game').css('display', 'none'); $('.menu-popup-spinId').css('padding-left', '93px'); $('.menu-popup-spinId').css('border-bottom-left-radius', '15px'); $('.game-exit-bt').css('display', 'none'); $('.exit-game').css('display', 'none'); } //disable quit when no returnurl END }); function CustomEvent(eventCode) { this.EventCode = eventCode; } var PingTimer = null; var PingTimerTime = 10000; function SendPing() { if ($('#GameId').val() != '') { eventUrl = urlHolder.Ping.Url + "/" + $('#GameId').val() + "/" + $("#Token").val(); $.post(eventUrl, function (data) { CallPingTimer(); }).fail(function (jqXHR, textStatus, errorThrown) { //SlotRequestFail(jqXHR, textStatus, errorThrown); }); } } function CallPingTimer() { if (PingTimer) clearTimeout(PingTimer); PingTimer = setTimeout(function () { PingTimer = null; SendPing(); }, PingTimerTime); } function PostCustomEvent(eventCode) { if ($("#GameId").val() == '') { return false; } eventUrl = urlHolder.Events.PostCustomEventUrl + "/" + $("#GameId").val() + "/" + $("#Token").val(); code = new CustomEvent(eventCode); $.post(eventUrl, code, function (data) { data = RenameObjectKeys(data); if (eventCode == 'leave.game') { if(GameName.toLowerCase() === 'footballx' || GameName.toLowerCase() === 'hunterx' || GameName.toLowerCase() === 'smashx' || GameName.toLowerCase() === 'rollx') { $('#Token').val(''); // leaveGame(); } if((GameName.toLowerCase() !== "footballx" || GameName.toLowerCase() !== "hunterx" || GameName.toLowerCase() !== "smashx" || GameName.toLowerCase() !== "rollx") && typeof gameEvent === 'function')gameEvent.quit(); if(gamesLobby) { parent.location.href = urlHolder.GameExit.Url; } else { top.location.href = urlHolder.GameExit.Url; } } else if (eventCode == 'update.balance') { PopupClose(); LoadGameData(data, eventCode); } else { LoadGameData(data, eventCode); } }).fail(function (jqXHR, textStatus, errorThrown) { RequestFail(jqXHR, textStatus, errorThrown); }); } function PostEvent(eventId, selectedOption, selectedPieces, selectedValue) { selectedPieces = selectedPieces !== undefined ? selectedPieces : ''; selectedValue = selectedValue !== undefined ? selectedValue : ''; if (selectedOption == 'Cashout') { lossepopup = false; } eventUrl = urlHolder.Events.PostEventUrl + "/" + $("#GameId").val() + "/" + $("#Token").val(); eventParams = new PostEventInfo(eventId, selectedOption, selectedPieces, selectedValue); ajaxReq = $.post(eventUrl, eventParams, function (data) { data = RenameObjectKeys(data); LoadPostEventData(data, selectedOption); }).fail(function (jqXHR, textStatus, errorThrown) { if (selectedOption != 'game.end') RequestFail(jqXHR, textStatus, errorThrown); }); } function PostEventInfo(eventId, selectedOption, selectedPieces, selectedValue) { this.EventId = eventId; this.SelectedOption = selectedOption; this.SelectedPieces = selectedPieces; this.SelectedValue = selectedValue; } var BetTypesTop = ''; var BetTypesBottom = ''; function listener(event) { if (event.data == 'update.balance') { if ($("#GameId").val() != '') { PostCustomEvent('update.balance'); } else { location.reload(); } } if (event.data !== undefined && event.data.name === "sound-toggle") { if ($('.game-sound-bt')[1]) { $('.game-sound-bt')[1].click(); } else { $('.game-sound-bt')[0].click(); } } } if (window.addEventListener) { addEventListener("message", listener, false) } else { attachEvent("onmessage", listener); } function PopupClose() { if (GameName === 'Bingo') Bingo.PlayClicked = false; else if (GameName === 'TripleSeven') TripleSeven.PlayClicked = false; else if (GameName === 'SweetCandy') SweetCandy.loadOptions(); $('.error-popup').css('display', 'none'); } function GetCurrentEvents() { if ($('#ErrorMessage').length) { $('.error-popup').css('display', 'block'); $('.error-popup-content').html($('#ErrorMessage #Message').html()).css({ 'padding-top': '15px', 'padding-bottom': '15px' }); if(gamesLobby) { $('.error-popup-bt').css('display', 'block').attr('onclick', 'parent.location.href = \'' + urlHolder.GameExit.Url + '\';'); } else { $('.error-popup-bt').css('display', 'block').attr('onclick', 'top.location.href = \'' + urlHolder.GameExit.Url + '\';'); } } else { var boardVersion = 0; eventUrl = urlHolder.Board.Url + "/" + $("#GameId").val() + "/" + $("#Token").val(); // + "/" + boardVersion ajaxReq = $.get(eventUrl, function (data) { data = RenameObjectKeys(data); SendPing(); if (data.GameState > 1) { location.reload(); } else { LoadGameData(data, 'Load'); } }).fail(function (jqXHR, textStatus, errorThrown) { RequestFail(jqXHR, textStatus, errorThrown); }); } } function GetCurrentBoard() { if ($('#ErrorMessage').length) { $('.error-popup').css('display', 'block'); $('.error-popup-content').html($('#ErrorMessage #Message').html()).css({ 'line-height': '24px', 'padding-top': '70px', 'padding-bottom': '30px' }); if(gamesLobby) { $('.error-popup-bt').css('display', 'block').attr('onclick', 'parent.location.href = \'' + urlHolder.GameExit.Url + '\';'); } else { $('.error-popup-bt').css('display', 'block').attr('onclick', 'top.location.href = \'' + urlHolder.GameExit.Url + '\';'); } } else { eventUrl = urlHolder.Board.Url + "/" + $("#GameId").val() + "/" + $("#Token").val(); $.get(eventUrl, function (data) { data = RenameObjectKeys(data); LoadGameData(data); }).fail(function (jqXHR, textStatus, errorThrown) { RequestFail(jqXHR, textStatus, errorThrown); }); } } function RequestFail(jqXHR, textStatus, errorThrown) { if (jqXHR.status == 401) { if (jqXHR.responseText == undefined || jqXHR.responseText == null || jqXHR.responseText == '') { location.reload(); } else { responseText = JSON.parse(jqXHR.responseText); var Message = GetCaption(responseText.Message); $('.error-popup').css('display', 'block'); $('.error-popup-content').html(Message).css({ 'padding-top': '15px', 'padding-bottom': '15px' }); if(gamesLobby) { $('.error-popup-bt').css('display', 'block').attr('onclick', 'parent.location.href = \'' + urlHolder.GameExit.Url + '\';'); } else { $('.error-popup-bt').css('display', 'block').attr('onclick', 'top.location.href = \'' + urlHolder.GameExit.Url + '\';'); } } } else if (jqXHR.status == 400) { responseText = JSON.parse(jqXHR.responseText); var Message = GetCaption(responseText.Message); if (GameName == 'SweetCandy' && responseText.Message == 'SweetCandy.bad.move') { gameContainer['Boxes'].container.removeChild(SweetCandy.boxes[SweetCandy.boxFirst].boxHover); SweetCandy.boxes[SweetCandy.boxFirst].boxHover = null; gameContainer['Boxes'].container.removeChild(SweetCandy.boxes[SweetCandy.boxSecond].boxHover); SweetCandy.boxes[SweetCandy.boxSecond].boxHover = null; SweetCandy.boxes[SweetCandy.boxFirst].newX = 39 + (SweetCandy.boxFirst % 8) * 80; SweetCandy.boxes[SweetCandy.boxFirst].newY = 26 + parseInt(SweetCandy.boxFirst / 8) * 80; SweetCandy.boxes[SweetCandy.boxSecond].newX = 39 + (SweetCandy.boxSecond % 8) * 80; SweetCandy.boxes[SweetCandy.boxSecond].newY = 26 + parseInt(SweetCandy.boxSecond / 8) * 80; if(sweetCandyMobile === true){ SweetCandy.boxes[SweetCandy.boxFirst].newX = 39 + (SweetCandy.boxFirst % 8) * 70; SweetCandy.boxes[SweetCandy.boxFirst].newY = 26 + parseInt(SweetCandy.boxFirst / 8) * 70; SweetCandy.boxes[SweetCandy.boxSecond].newX = 39 + (SweetCandy.boxSecond % 8) * 70; SweetCandy.boxes[SweetCandy.boxSecond].newY = 26 + parseInt(SweetCandy.boxSecond / 8) * 70; } SweetCandy.boxSwap = true; } else { $('.error-popup').css('display', 'block'); $('.error-popup-content').html(Message).css({ 'padding-top': '15px', 'padding-bottom': '15px' }); $('.error-popup-bt').css('display', 'block').attr('onclick', 'PopupClose();'); } } else if (jqXHR.status == 410) { responseText = JSON.parse(jqXHR.responseText); var Message = GetCaption(responseText.Message); $('.error-popup').css('display', 'block'); $('.error-popup-content').html(Message).css({ 'padding-top': '15px', 'padding-bottom': '15px' }); if(gamesLobby) { $('.error-popup-bt').css('display', 'block').attr('onclick', 'parent.location.href = \'' + urlHolder.GameExit.Url + '\';'); } else { $('.error-popup-bt').css('display', 'block').attr('onclick', 'top.location.href = \'' + urlHolder.GameExit.Url + '\';'); } } else { $('.error-popup').css('display', 'block'); $('.error-popup-content').html(GetCaption('game.create.is.disabled')).css({ 'padding-top': '15px', 'padding-bottom': '15px' }); //$('.popup-bt').css('display', 'none'); if(gamesLobby) { $('.error-popup-bt').css('display', 'block').attr('onclick', 'parent.location.href = \'' + urlHolder.GameExit.Url + '\';'); } else { $('.error-popup-bt').css('display', 'block').attr('onclick', 'top.location.href = \'' + urlHolder.GameExit.Url + '\';'); } } } function LoadPostEventData(data, selectedOption) { LoadGameData(data, selectedOption); if (selectedOption == '') { $('.cashout').removeClass("loading").removeClass("active").addClass("disable"); } if (selectedOption == 'ChooseCard') { BetTypesTop = ''; BetTypesBottom = ''; } lossepopup = true; } $(".game-exit-bt").click(function () { if ($(".game-fullscreen-bt").hasClass('active')) { try { exitFullscreen() } catch (e) { } } }) let loaderWithPercent = false; function PixiLiader(PixiLoader, CpuntJS) { var resourceCount = CpuntJS * 3; var loaderCount = 0; loaderWithPercent = true PixiLoader.onProgress.add(() => { loaderCount++; let width = (loaderCount / resourceCount) * 100; if (width >= 100) { setTimeout(function () { if (GameName !== 'VaBank' && GameName !== 'PlinkoX' && GameName !== 'SmashX' && GameName !== 'PlinkoJoker') $('.loader-div').fadeOut(100); }, 10); setTimeout(() => { window.parent.postMessage({name: "loaded"}, "*"); }, 110); } width = width > 100 ? 100 : width; $('.loader-bar div').stop().animate({ width: width + '%' }, { duration: 100, easing: 'linear', step: function (x) { $('.loader-text').html(`${parseInt(x)}%`); //console.log($('.loader-text').html()); } }); }); } window.onload = function(){ if(loaderWithPercent === false){ window.parent.postMessage({name: "loaded"}, "*"); } } window.addEventListener('load', (event) => { if(GetGameVersion()) { window.parent.postMessage({name: 'game-version', version: GetGameVersion()}, "*"); } }); document.addEventListener('touchmove', e => { if (e.touches.length > 1) { e.preventDefault(); } }, {passive: false}) function GetGameVersion() { const GAME_VERSION = $('#Version').val(); if(GAME_VERSION) GameVersion = GAME_VERSION return GAME_VERSION; } // Get parameter by name function getParentParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); var results = null; try { results = regex.exec(parent.location.search); } catch (e) { } return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)") var results = null; try { results = regex.exec(location.search); } catch (e) { } return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); }